import { EntitySchema } from '@mikro-orm/core';
import { ChatRooms } from './ChatRooms';
import { Users } from './Users';

export class ChatRoomMembers {
  room!: ChatRooms;
  user!: Users;
}

export const ChatRoomMembersSchema = new EntitySchema({
  class: ChatRoomMembers,
  properties: {
    room: {
      primary: true,
      reference: 'm:1',
      entity: () => ChatRooms,
      index: 'chat_room_foreign_key',
    },
    user: {
      primary: true,
      reference: 'm:1',
      entity: () => Users,
      index: 'member_foreign_key',
    },
  },
});
